package com.example.mooney.domain;

import javax.persistence.Entity;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import org.springframework.roo.addon.entity.RooEntity;
import org.springframework.roo.addon.javabean.RooJavaBean;
import org.springframework.roo.addon.tostring.RooToString;
import java.util.Set;
import com.example.mooney.domain.Transaction;
import java.util.HashSet;
import javax.persistence.ManyToMany;
import javax.persistence.CascadeType;
import javax.persistence.OneToMany;

@Entity
@RooJavaBean
@RooToString
@RooEntity
public class Category {

    @NotNull
    @Size(max = 30)
    private String label;

    @OneToMany(cascade = CascadeType.ALL, mappedBy = "category")
    private Set<Transaction> transactions = new HashSet<Transaction>();
}
